<template>
  <view class="buySucceed">
    <view>
      <view class="image">
        <image
          src="../../../static/iamges/maichu/maichuchenggong@2x.png"
          mode=""
        ></image>
        <view
          >购买 <text>{{ data.name }}</text
          >成功 <text>{{ data.money }}元</text></view
        >
      </view>
      <view class="txt">
        <view>支付方式</view>
        <view>我的钱包</view>
      </view>
    </view>
    <button class="bt1" @click="goTo">再去逛逛</button>
    <button class="bt2" @click="goToMyCenter">查看我的资产</button>
    <view class="countdown">
      倒计时
      <uni-countdown
        :show-day="false"
        :second="6"
        @timeup="goToIndex"
      ></uni-countdown
      >秒，跳转首页
    </view>
  </view>
</template>

<script>
import colorGradient from "../../../uview-ui/libs/function/colorGradient";
export default {
  onLoad: function (option) {
    console.log(option, "ppppppp");
    this.data = option;
  },
  data() {
    return {
      data: {},
    };
  },
  methods: {
    goTo() {
      console.log(this.data.url);
      uni.reLaunch({
        url: this.data.url,
        success(res) {
          console.log(res);
        },
        fail(res) {
          console.log(res);
        },
      });
    },
    goToMyCenter() {
      console.log(2);
      // uni.switchTab({
      //   url: '/pages/index/index'
      // });
      uni.reLaunch({
        url: "/pages/bonds/bonds",
        success(res) {
          console.log(res);
        },
        fail(res) {
          console.log(res);
        },
      });
    },
    goToIndex() {
      console.log(3);

       uni.switchTab({
        url: '/pages/index/index',

      });
    },
  },
};
</script>


<style lang="scss" scoped>
.buySucceed {
  .countdown {
    display: flex;
    justify-content: center;
    align-content: center;
    align-items: center;
  }
  background-color: #fafafa;
  text {
    color: red;
  }
  > view {
    background-color: #ffffff;

    .image {
      display: flex;
      flex-direction: column;
      align-items: center;
      height: 220rpx;
      justify-content: flex-end;
      margin: 40rpx 0;
      font-size: 36rpx;
      view {
        padding: 20rpx 0;
      }
      image {
        width: 100rpx;
        height: 100rpx;
      }
    }
    .txt {
      display: flex;
      justify-content: space-between;
      padding: 20rpx;
      font-size: 20rpx;
      color: #474747;
    }
  }

  button {
    margin: 20rpx;
    border-radius: 16rpx;
    border: 1px solid rgba(255, 255, 255, 0);
  }
  .bt1 {
    color: #ffffff;
    background-color: red;
  }
  .bt2 {
    background-color: #ffffff;
  }
}
</style>
